package com.spark.market.controller;

import com.spark.market.api.dto.ItemInfo;
import com.spark.market.api.request.ItemAddParam;
import com.spark.market.api.utils.ResponseResult;
import com.spark.market.api.utils.ResponseUtil;
import com.spark.market.common.utils.AssertUtils;
import com.spark.market.service.ItemCmdCoreService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("item/cmd")
public class ItemCmdController extends BaseController{
    @Resource
    ItemCmdCoreService itemCmdCoreService;
    @PostMapping(value = "addItem")
    public ResponseResult<ItemInfo> addItem(@RequestBody ItemAddParam param){
        AssertUtils.isNotNull(param, "ItemInfo is null");
        return ResponseUtil.createSuccessResult(itemCmdCoreService.createItem(param));
    }
}
